<% 
	reports_list, role  = reports_xb_status
	title = _("Cross Border Report Status")+ " " + _(role.coordinated.name)
%>



<div id="xborder_status_table">
	<span class="title_one"><%= _(title) %></span>
	<table class="xbtable_short" cellspacing="0" cellpadding="0">
		
		<tr>
	        <th class="col1"><%= _('Title') %></th>
	        <th class="col2"><%= _('XB') %></th>
	        <th class="col3"><%= _('Completed') %></th>
	        <th class="col4"><%= _('Matching XB Status') %></th>
	    </tr>
			<% reports_list.each_with_index do |report,count| %>
				<% request = report.report_request %>
				<tr>
					<td class="col1">
						<a href="" onmouseover="setVisibility('xb<%=count%>', 'inline');" onmouseout="setVisibility('xb<%=count%>', 'none');">
							<%= report.owner_role.site.cross_borders.map { |xb| "XB#{xb.number}" }.join(', ') %> <%=request.title_and_period %> - <%= report.owner_role.site.city%>
						</a>
					</td>
					<td class="col2"><%=report.owner_role.site.cross_borders.map(&:number).join(', ')%></td>
					<td class="col3"><%if not report.completed.nil?
							value = report.completed*100
							imgname = case value.to_i 
								when 0..20 then "perc20.gif"
								when 21..40 then "perc40.gif"
								when 41.. 60 then "perc60.gif"
								when 61..80 then "perc80.gif"
								when 81..100 then  "perc100.gif"
						end end%>
					<%= image_tag imgname rescue nil%>
					<%= percentage report.completed rescue nil%> </td>
					<td class="col4"> <%=report.matching_xbs_completed rescue nil%> 
					<%= _(report.matching_site_names) rescue nil %></td>
				</tr>
			<% end %>
	</table>
</div><!--/xborder_status_table-->

<% reports_list.each_with_index do |report,count| %>
	<div id="xb<%=count%>" class="xborder_status_description">
	
   		<span>
   			<b><%= report.owner_role.site.cross_borders.map { |xb| "XB#{xb.number}" }.join(', ') %>
			<%=report.report_request.title_and_period %> - <%= report.owner_role.site.city%></b>
		</span>
		<ul>			
            <% report.report_edits.each do |log| %>
				<li> <b><%= log.created_at.strftime("%c") %></b> <%= log.description %> by <%= log.user_name %></li>
			<% end %>
		</ul>	

    </div>
<% end %>